<%@ page import="com.lihuanyu.upcOA.conn.databaseUtil" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.util.Calendar" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    int tid = 0;
  if(session.getAttribute("tid") != null) {
      tid = Integer.parseInt(session.getAttribute("tid").toString());
  }
    //System.out.print("111111111111111111111111");
    //System.out.print("tid="+tid);
  Calendar a= Calendar.getInstance();
  int year=a.get(Calendar.YEAR);
  //System.out.print(year);
  request.setCharacterEncoding("utf-8");
  String teaname = request.getParameter("teaname") == null ? "" : new String(request.getParameter("teaname"));
  String swhole = request.getParameter("swholenum") == null ? "" : new String(request.getParameter("swholenum"));
  String sinnum = request.getParameter("sinnum") == null ? "" : new String(request.getParameter("sinnum"));
  String soutnum = request.getParameter("soutnum") == null ? "" : new String(request.getParameter("soutnum"));
  databaseUtil db = new databaseUtil();
  String sql = "INSERT INTO `gradua_design`(`teaname`, `year`, `innum`, `outnum`, `postguraduate`,`tid`)" +
          " VALUES ('"+teaname+"','"+year+"','"+sinnum+"','"+soutnum+"','"+swhole+"',"+tid+")";
    //System.out.print(sql);
  System.out.print(sql);
  db.executeUpdate(sql);
  %>
<tr>
  <div class="col-md-1">
    <th>指导老师</th>
  </div>
  <div class="col-md-1">
    <th>指导人数</th>
  </div>
  <div class="col-md-1">
    <th>校内人数</th>
  </div>
  <div class="col-md-1">
    <th>校外人数</th>
  </div>
</tr>
<form method="post" action="#" name="gradesign">
  <tr style="display: none" class="add_row">
    <div class="col-md-1">
      <td><input type="text" name="teacher_name1" id="teaname1"></td>
    </div>
    <div class="col-md-1">
      <td><input type="text" name="whole_num" id="swholenum"></td>
    </div>
    <div class="col-md-1">
      <td><input type="text" name="sinnum" id="sinnum"></td>
    </div>
    <div class="col-md-1">
      <td><input type="text" name="soutnum" id="soutnum"></td>
    </div>
  </tr>
</form>
<%
  sql="select * from gradua_design where tid="+tid+"";
  db.executeQuery(sql);
  ResultSet rs = db.getRs();
  while (rs.next()){
    String teachername= rs.getString(2);
    String innum = rs.getString(4);
    String outnum = rs.getString(5);
    String whole = rs.getString(6);
    %>
<tr class="second">
  <div class="col-md-1">
    <td><%=teachername%></td>
  </div>
  <div class="col-md-1">
    <td><%=whole%></td>
  </div>
  <div class="col-md-1">
    <td><%=innum%></td>
  </div>
  <div class="col-md-1">
    <td><%=outnum%></td>
  </div>
</tr>
<%
  }
  db.sqlclose();
%>
